<template>
  <div class="home">
    <div class="header">
      <h2>后台管理系统</h2>
      <div>{{user.username}}</div>
    </div>
    <div class="mian">
      <div class="main-1">
        <div>{{user.typename}}</div>
        <div class="left">
          <router-link v-for="(item,index) in list" :key="index" :to="item.path">{{item.name}}</router-link>
        </div>
        <div class="router">
          <router-view></router-view>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  data() {
    return {
      list: [],
      user: []
    };
  },
  created() {
    this.list = this.$store.state.getAuth.filterList[0].children;
    this.user = localStorage.getItem("user");
    this.user = this.user
    console.log(this.$store);
  }
};
</script>

<style>
.home {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
}
.header {
  width: 100%;
  height: 60px;
  background: #4381e6;
  color: #fff;
  padding-left: 20px;
  padding-top: 10px;
}
.main {
  flex: 1;
  overflow-y: auto;
}
.main-1 {
  display: flex;
}
.left {
  width: 200px;
  color: #fff;
  height:700px;
  background: #001529;
}
.header h2 {
  color: #ffffff;
  font-weight: bold;
}
.left a {
  display: inline-block;
  width: 200px;
  height: 50px;
  line-height: 50px;
  color: #999999;
}
.left a.router-link-active {
  background: #ffffff;
  font-weight: bold;
  color: #000;
}
</style>